from django.contrib.auth.models import Permission, Group
from django.contrib.contenttypes.models import ContentType
from rest_framework.serializers import ModelSerializer


# 权限表的序列化器
class PermissionModelSerializer(ModelSerializer):
    class Meta:
        model = Permission
        fields = '__all__'


# 权限类别的序列化器
class ContentTypeModelSerializer(ModelSerializer):
    class Meta:
        model = ContentType
        # 其中name是描述符对象
        fields = ['id', 'name']


# 组的序列化器
class GroupSerializer(ModelSerializer):
    class Meta:
        model = Group

        fields = '__all__'


